<template>
  <div class="hello">
    <header class="header">
      <div>
        <img src="http://w.wantscart.com/static/images/3.png" alt="">
      </div>
      <div>
        <img src="http://w.wantscart.com/static/images/1.png" alt="">
        <span>潮流新品特卖</span>
      </div>
      <div>
        <img src="http://w.wantscart.com/static/images/2.png" alt="">
      </div>
    </header>

    <div class="search">
      <header class="search-header">
        <div>
          <img src="http://w.wantscart.com/static/images/7.jpg" alt="">
        </div>
        <div>
          <img src="http://w.wantscart.com/static/images/6.jpg" alt="">
        </div>
        <div>
          <form action="" :onsubmit="searchsubmit()">
            <input type="text" placeholder="请输入搜索内容" v-model="HS">
          </form>
        </div>
        <div class="cha">
          <p>×</p>
        </div>
      </header>
      <div class="hot-search">
        <div>
          <p>热门搜索</p>
        </div>
        <ul>
          <li v-for="(item,index) in hotwords" :key="index" v-text="item"></li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'HelloWorld',
    data() {
      return {
        hotwords:[],
        HS:''
      }
    },
    created(){
      this.hotSearch()
    },
    methods:{
      hotSearch:function () {
        var _this = this
        this.$http.get('/wants/config?key=search_hotwords').then(function (value) {
          _this.hotwords = value.body[0]
        })
      },
      searchsubmit:function () {
        var _this = this
        this.$http.get('/wants/product/w/'+this.HS+'?m=1&limit=18').then(function (value) {
          console.log(value)
        })
      }
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  ul{
    list-style: none;
    padding: 0;
  }
  .header {
    width: 100vw;
    height: 12vw;
    background: #fff034;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5vw;
  }

  .header div img {
    width: 5vw;
    height: 5vw;
  }

  .header div:nth-child(2) img {
    width: 3.3vw;
    height: 3.3vw;
  }

  .header div:nth-child(2) {
    width: 70vw;
    height: 7vw;
    background: white;
    line-height: 7vw;
    color: #D6D6D6;
    font-size: 12px;
  }

  .search {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    background: white;
  }

  .search-header {
    width: 100vw;
    height: 14vw;
    display: flex;
    align-items: center;
    padding: 0 5vw;
  }

  .search-header img {
    width: 8vw;
    height: 8vw;
  }

  .search-header div:first-child img {
    margin-right: 10vw;
  }

  .search-header input {
    width: 60vw;
    font-size: 20px;
    border: 0;
  }
  .search-header p{
    font-size: 8vw;
    line-height: 8vw;
  }

  .hot-search>div{
    width: 100vw;
    height: 14vw;
    background: #fbfbfb;
    line-height: 14vw;
    padding-left: 5vw;
  }
  .hot-search>div p{
    font-size: 20px;
    text-align: left;
    color: #555;
  }
  .hot-search ul{
    overflow: hidden;
    z-index: 1;
  }
  .hot-search ul li{
    float: left;
    font-size: 15px;
    padding: 0 3vw;
    margin: 2vw 3vw;
    background: white;
    color: #999;
    border: 1px solid #999;
    border-radius: 1vw;
  }

  .cha{
    display: none;
  }
</style>
